interface IPoint {
  x: number;
  y: number;
  log: () => void;
  distanceFrom: (point: IPoint) => number;
}

export default class Point implements IPoint {
  constructor(private _x: number = 0, private _y: number = 0) {}
  get x() {
    return this._x;
  }
  get y() {
    return this._y;
  }
  log() {
    console.log(`(${this._x}, ${this._y})`);
  }
  distanceFrom(point: IPoint) {
    return Math.sqrt(
      Math.pow(this._x - point.x, 2) + Math.pow(this._y - point.y, 2)
    );
  }
}
